using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;

namespace MyRobot
{
    public abstract class Node : List<Node>
    {
        private string _name;
        private Dictionary<Node, Relation> _links = new Dictionary<Node, Relation>();
        private PropertyClass _Properties;

        public Node(string Name)
        {
            _name = Name;
            this.Add(this);
            this.Links.Add(this, new Relation(Relation.RelationType.Self));
        }

        public Node()
        {
        }

        public class PropertyClass
        {
            public Message.Status Status;
        }

        public PropertyClass Properties
        {
            get { return _Properties; }
            set { _Properties = value; }
        }

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public Dictionary<Node, Relation> Links
        {
            get { return _links; }
            set { _links = value; }
        }
    }

    public class Relation
    {
        private RelationType _type;

        // From ConceptNet 3 http://csc.media.mit.edu/docs/conceptnet/conceptnet4.html#relations
        public enum RelationType
        {
            Self,
            IsA,                   // What kind of thing is it?
            HasA,                  // What does it possess?
            PartOf,                // What is it part of?
            UsedFor,               // What do you use it for?
            AtLocation,            // Where would you find it?
            CapableOf,             // What can it do?
            MadeOf,                // What is it made of?
            CreatedBy,             // How do you bring it into existence?
            HasSubevent,           // What do you do to accomplish it?
            HasFirstSubevent,      // What do you do first to accomplish it?
            HasLastSubevent,       // What do you do last to accomplish it?
            HasPrerequisite,       // What do you need to do first?
            MotivatedByGoal,       // Why would you do it?
            Causes,                // What does it make happen?
            Desires,               // What does it want?
            CausesDesire,          // What does it make you want to do?
            HasProperty,           // What properties does it have?
            ReceivesAction,        // What can you do to it?
            DefinedAs,             // How do you define it?
            SymbolOf,              // What does it represent?
            LocatedNear,           // What is it typically near?
            ObstructedBy,          // What would prevent it from happening?
            ConceptuallyRelatedTo, // What is related to it in an unknown way?
            InheritsFrom           // (not stored, but used in some applications)
        }

        public Relation(RelationType type)
        {
            _type = type;
        }

        public RelationType Type
        {
            get { return _type; }
            set { _type = value; }
        }
    }
}
